#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
struct Edge{
   LL to,cost;
};
vector<Edge>g[maxn];
LL ans1,ans2,n;
LL siz[maxn];
void dfs1(LL u,LL fa){
     siz[u]=1;
     for(LL i=0;i<g[u].size();i++){
         LL v=g[u][i].to;
         if(v==fa) continue;
         dfs1(v,u);
         siz[u]+=siz[v];
     }
}
void dfs2(LL u,LL fa){
     for(LL i=0;i<g[u].size();i++){
         LL v=g[u][i].to;
         LL val=g[u][i].cost;
         if(v==fa) continue;
         ans2+=val*min(siz[v],n-siz[v]);
         if(siz[v]&1){
            ans1+=val;
         }
         dfs2(v,u);
     }
}
int main(void){
   cin.tie(0);std::ios::sync_with_stdio(false);
   LL t;cin>>t;
   while(t--){
      LL k;cin>>k;
      ans1=ans2=0;
      n=2*k;
      for(LL i=0;i<2*k+10;i++) siz[i]=0,g[i].clear();
      for(LL i=1;i<=2*k-1;i++){
          LL u,v,val;cin>>u>>v>>val;
          g[u].push_back({v,val});
          g[v].push_back({u,val});
      }
      dfs1(1,-1);
      dfs2(1,-1);
      cout<<ans1<<" "<<ans2<<"\n";
   }
   return 0;
}
